﻿using System;
using System.Collections.Generic;
using System.Linq;
using Netkk.Common;
using Netkk.Common.Models;
using Netkk.Data.Provider;

namespace Netkk.Library.Repositories
{
    public class UserRepository : IUserRepository
    {

        private static DataProvider Provider
        {
            get { return DataProviderManager.Provider; }
        }

        public IEnumerable<User> Select()
        {
            IEnumerable<User> rawUsers = Provider.SelectAllUsers();
            IEnumerable<User> users = from u in rawUsers
                                      where u.Role.Role != Roles.Guest
                                      select u;
            return users;
        }

        public void Delete(User user)
        {
            Provider.DeleteUser(user);
        }

        public void Save(User user)
        {
            Provider.SaveUser(user);
        }




    }

}
